package com.atguigu.srb.core.controller.api;


import com.atguigu.srb.base.response.R;
import com.atguigu.srb.core.pojo.entity.vo.BorrowerVO;
import com.atguigu.srb.core.service.BorrowerService;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;

/**
 * <p>
 * 借款人 前端控制器
 * </p>
 *
 * @author Atguigu
 * @since 2023-05-26
 */
@RestController
@RequestMapping("/api/core/borrower")
public class ApiBorrowerController {
    @Resource
    BorrowerService borrowerService;
    @ApiOperation("查询借款人审核状态")
    @GetMapping("auth/status")
    public R status(@RequestHeader("token")String token){
        Integer status = borrowerService.getStatus(token);
        return R.ok().data("status" , status);
    }
    @ApiOperation("保存借款人信息")
    @PostMapping("auth/borrowerVO")
    public R saveBorrowerVO(@RequestBody BorrowerVO borrowerVO,
                            //HttpServletRequest request,
                            @RequestHeader("token")String token){
        borrowerService.saveBorrowerVO(borrowerVO,token);
        return R.ok();
    }
}

